#pragma once

#include <string>
#include <render/Others/PerseusLibDefines.h>

namespace pwp::MathUtils {

void MatrixVectorProduct(float **matrix, float *vector, float* output, int vectorSize);

void SquareMatrixProduct(double *c, const double *a, const double *b, int dim);
void SquareMatrixProduct(float *c, const float *a, const float *b, int dim);
void SquareMatrixProduct(long double *c, const long double *a, const long double *b, int dim);

void MatrixVectorProduct4Inplace(double *matrix, double *vector);
void MatrixVectorProduct4Inplace(float *matrix, float *vector);
void MatrixVectorProduct4Inplace(long double *matrix, long double *vector);

void InvertMatrix4Pose(float *out, float *in);
void TransposeSquareMatrix(float *in, float *out, int size);

void MatrixVectorProduct4(const double *matrix, const double *vector, double *vectorOutput);
void MatrixVectorProduct4(const float* matrix, const float* vector, float* vectorOutput);
void MatrixVectorProduct4(long double *matrix, long double *vector, long double *vectorOutput);

void MatrixVectorProduct4(float *matrix, double *vector, float *vectorOutput);
void MatrixVectorProduct4(float *matrix, float *vector, double *vectorOutput);

void InvertMatrix4(float *dst, float *mat);
void InvertMatrix4(double *dst, double *mat);
void InvertMatrix4(long double *dst, long double *mat);

int GetMinor(float **src, float **dest, int row, int col, int order);
double CalcDeterminant( float **mat, int order);
void InvertMatrix(float **Y, int order, float **A);

void ConvertArray(double *dst, float* src, int dim);
void ConvertArray(float *dst, double* src, int dim);

float MatrixDeterminant3(float a[3][3]);
void InvertMatrix3(float in[3][3], float a[3][3]);

}
